<?php
/**
 * Created by PhpStorm.
 * Author: WZS
 * User: 17732
 * Date: 2018/9/9
 * Time: 17:21
 */

namespace app\index\model;


use think\Model;

class Comment extends Model
{
    public static function insertComment($name = '',$comment){
        $data = [
            'name'=>$name,
            'comment'=>$comment,
            'add_time'=>time(),
        ];
        $comment = \model('comment');
        return $comment->save($data);
    }
    // 获取数据
    public static function getComment($start,$pageSize = 8){
        $comment = \model('comment');
        return $comment->order('add_time desc')->limit($start,$pageSize)->select();
    }
    // 获取总条数
    public static function getCountComment(){
        $comment = \model('comment');
        return $comment->count('id');
    }
}